
#ifndef _MEMBER_BTabWidget_H_
#define _MEMBER_BTabWidget_H_

#include <BRect>
#include <BArray>
#include <BAction>
#include <BIcon>
#include <BTabWidget>

namespace BWE
{
	class BWidget;

	class TabItem
	{
	public:
		TabItem()
		{
			widget = 0;
		}
		bool operator == (const BWidget* widget) const
		{
			return this->widget == widget;
		}

		BWidget*		widget;
		BIconHolder		icon;
		BRect			rect;
		BString			t_title;
		BRect			iconRect;
		BSize			textSize;
		BRect			textRect;
		BRect			closeRect;
	};
	
	class member_BTabWidget : public BObject
	{
	public:
		member_BTabWidget(BTabWidget* tabWidget);
		~member_BTabWidget();

		void procTitleChanged(BObject* object, const BValue& value);

		void freshRects();
		void reviseTab();

		int indexOf(BWidget* widget);
		BRect rectOf(BWidget* widget);

		BTabWidget*			boss;
		bool				dirty;
		int					space;
		BSize				tabSize;
		BSize				iconSize;
		bool				tabClosable;
		int					begin;
		int					hoverIndex;
		bool				hoverClose;
		BIconHolder			closeIcon;
		BWidgetArray		stack;
		BList<TabItem>		items;
	};
}

#endif